home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / util / boot / AmyShutDown_sr.lha / ShutDown_cat.c < prev    next >
C/C++ Source or Header  |  1997-06-05  |  2KB  |  87 lines

  1. // catalog parser for AmyShutDown
  2.  
  3. /* Prototypes */
  4. #ifdef __SASC
  5. #include <clib/locale_protos.h>
  6. #include <clib/dos_protos.h>
  7. #else
  8. #include <proto/locale.h>
  9. #include <proto/dos.h>
  10. #endif /* __SASC */
  11.  
  12. /* Pragmas */
  13. #if defined(__SASC)
  14. #include <pragmas/locale_pragmas.h>
  15. #endif    /*  __SASC */
  16.  
  17. #ifdef __GNUC__
  18. #include <inline/locale.h>
  19. #endif    /*  __GNUC__    */
  20.  
  21. static LONG ShutDownStrings_Version = 0;
  22. static const STRPTR ShutDownStrings_BuiltInLanguage = (STRPTR) "english";
  23.  
  24. struct FC_Type
  25. {   LONG   ID;
  26.     char *Str;
  27. };
  28.  
  29. /* Definitions */
  30. const struct FC_Type _MSG_winChoose = { 2, "ShutDown System?" };
  31. const struct FC_Type _MSG_labSelect = { 3, "\033b\033cP_lease Select" };
  32. const struct FC_Type _MSG_radOptions = { 4, "l\00" };
  33. const struct FC_Type _MSG_radOptions0 = { 5, "ShutDown the system" };
  34. const struct FC_Type _MSG_radOptions1 = { 6, "Reboot the system" };
  35. const struct FC_Type _MSG_butOk = { 7, "O_k" };
  36. const struct FC_Type _MSG_butCancel = { 8, "Ca_ncel" };
  37.  
  38. #ifdef __SASC
  39. extern struct Library *LocaleBase;
  40. #endif /* __SASC */
  41. extern void CloseAppCatalog(void);
  42.  
  43. static struct Catalog *ShutDownStrings_Catalog = NULL;
  44.  
  45. void OpenAppCatalog(struct Locale *loc, STRPTR language)
  46. {
  47.     LONG tag, tagarg;
  48.  
  49.     CloseAppCatalog(); /* Not needed if the programmer pairs OpenAppCatalog
  50.             and CloseAppCatalog right, but does no harm.  */
  51.  
  52.     if (LocaleBase != NULL  &&  ShutDownStrings_Catalog == NULL)
  53.     {
  54.     if (language == NULL)
  55.         tag = TAG_IGNORE;
  56.     else
  57.     {
  58.         tag = OC_Language;
  59.         tagarg = (LONG) language;
  60.     }
  61.     ShutDownStrings_Catalog = OpenCatalog(loc, (STRPTR) "AmyShutDown.catalog",
  62.             OC_BuiltInLanguage,(LONG)ShutDownStrings_BuiltInLanguage,
  63.             tag, tagarg,
  64.             OC_Version, ShutDownStrings_Version,
  65.             TAG_DONE);
  66.     }
  67. }
  68.  
  69. void CloseAppCatalog(void)
  70. {
  71.     if (LocaleBase != NULL)
  72.         CloseCatalog(ShutDownStrings_Catalog);
  73.     ShutDownStrings_Catalog = NULL;
  74. }
  75.  
  76. char * GetShutDown_SystemString(APTR fcstr)
  77. {
  78.     char *defaultstr;
  79.     LONG strnum;
  80.  
  81.     strnum = ((struct FC_Type *) fcstr)->ID;
  82.     defaultstr = ((struct FC_Type *) fcstr)->Str;
  83.  
  84.     return(ShutDownStrings_Catalog ? (char *)GetCatalogStr(ShutDownStrings_Catalog, strnum, defaultstr) :
  85.             defaultstr);
  86. }
  87.